<!DOCTYPE html>
<html>
<head>
   <title>CSS Animations - animation-play-state, two values</title>
   <link rel="author" title="Opera Software ASA" href="http://www.opera.com/">
   <link rel="help" href="http://dev.w3.org/csswg/css3-animations/#the-animation-play-state-property-">
   <meta name="flags" content="dom">
   <meta name="assert" content="'paused, running' is a valid
   animation-play-state value">
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
   <style type="text/css">
      @keyframes move-right {
         from, to {
            left: 0px;
         }
         50% {
            left: 100px;
         }
      }
      @keyframes move-down {
         from, to {
            top: 0px;
         }
         50% {
            top: 100px;
         }
      }
      div {
         width: 100px;
         height: 100px;
         background: blue;
         position: relative;
         animation-duration: 1s;
         animation-fill-mode: forwards;
         animation-timing-function: step-end;
      }
      .test {
         animation-name: move-right, move-down;
      }
      .paused {
         animation-play-state: paused, running;
      }
   </style>
   <script type="text/javascript">
      setup({explicit_done:true});
      onload = function() {
         var testName = document.querySelector('title').firstChild.data;
         var div = document.querySelector('div');
         var log = document.querySelectorAll('p')[1].firstChild;
         var style = getComputedStyle(div, null);
         var passed = false;
         var timeout = setTimeout(function() {
            test(function(){assert_true(false);}, testName); done();
            log.data = 'FAIL';
         }, 1500);
         setTimeout(function() {
            div.className = 'test paused';
            passed = (style.left == '100px' && style.top == '100px');
         }, 750);
         div.addEventListener('animationend', function(evt) {
            clearTimeout(timeout);
            if (evt.animationName != 'move-down') {
               passed = false;
            }
            passed = (passed && style.left == '100px' && style.top == '0px');
            test(function(){assert_true(passed);}, testName); done();
            log.data = (passed ? 'PASS if the animation occurred.' : 'FAIL');
         });
         div.className = 'test';
      }
   </script>
   <style>iframe{display:none}</style>
</head>
<body>
   <p>The blue square below should jump diagonally down and right, then directly
   upwards.</p>
   <p>Testing...</p>
   <div></div>
</body>
</html>
